﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace bank
{
    internal class Bank
    {
        private List<Account> List = new List<Account>();

        public Bank() 
        {
            
        }

        public Account OpenAccount(string id, string password, double balance)
        {
            List.Add(new Account(id, password, balance));
            return new Account(id, password, balance);
        }

        public Account FindAccount(string id)
        {
            Account listFind = List.Find(e =>
            {
                if (e.id == id)
                {
                    return true;
                }
                else
                {
                    return false;
                }
            });
            return listFind;
        }

        public Account OpenCreditCardAccount(string id, string password, double limit)
        {
            List.Add(new CreditCardAccount(id,password,limit));
            return new Account(id, password, 0);

        }
    }
}
